﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;
using BLL;

namespace _3tiers
{
    public partial class tab3_Form_ThemLop : Form
    {
        public tab3_Form_ThemLop()
        {
            InitializeComponent();            
        }

        private void tab3_Form_ThemLop_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'khoaHocDataSet.tblKhoaHoc' table. You can move, or remove it, as needed.
            //this.tblKhoaHocTableAdapter.Fill(this.khoaHocDataSet.tblKhoaHoc);
            // TODO: This line of code loads data into the 'lopDataSet.tblLop' table. You can move, or remove it, as needed.
            this.tblLopTableAdapter.Fill(this.lopDataSet.tblLop);
            
        }

        private void btReset_Click(object sender, EventArgs e)
        {
            tbTenLop.Text = "";
        }
        DataAccess ac = new DataAccess();
        BLL.BLL business = new BLL.BLL();
        private void btThemLop_Click(object sender, EventArgs e)
        {
            try
            {
                string idKhoaHoc = cbbKhoaHoc.SelectedValue.ToString();
                string sql = "insert into tblLop values('c','" + idKhoaHoc + "','" + tbTenLop.Text + "')";
                business.Insert(sql);
                lbThongBao.Text = "Thêm lớp thành công.";
            }
            catch { lbThongBao.Text = "Thêm lớp thất bại"; }
            tab3_Form_ThemLop_Load(sender, e);
        }

        private void btThemKhoaHoc_Click(object sender, EventArgs e)
        {
            
        }

        private void btSuaKhoaHoc_Click(object sender, EventArgs e)
        {
            
        }
    }
}
